<?php
require_once(APP_PATH . "Common/yzs1013_pldr.php");
$t=new t($config['DB_HOST'],$config['DB_USER'],$config['DB_PWD'],$config['DB_NAME']);
if($_GET['a']=="adel"&&$_GET['id']>0){
    $t->sql("delete from user_auto_url where id='{$_GET['id']}'");
    echo "<script>parent.o.sB1.click()</script>";
    exit;
}

if($_GET['a']=="udel"&&$_GET['id']>0){
    $t->sql("delete from user_ptpass where id='{$_GET['id']}'");
    echo "<script>parent.o.sB1.click()</script>";
    exit;
}

if(trim($_POST['sB1'])==""&&trim($_POST['pthost'])!=""&&trim($_POST['aptid'])!=""&&trim($_POST['atid'])!=""&&trim($_POST['alisturl'])!=""&&trim($_POST['agindex'])!=""){
    $data['userid']=trim($_POST['userid']);
    $data['ip']=getIP();
    $data['pthost']=trim($_POST['pthost']);
    $data['ptid']=trim($_POST['aptid']);
    $data['tid']=trim($_POST['atid']);
    $data['ptusername']=trim($_POST['aptusername']);
    $data['listurl']=trim($_POST['alisturl']);
    $data['gindex']=trim($_POST['agindex']);
    $where="(ip='{$data[ip]}' or userid='{$data[userid]}' and userid<>'' and userid<>0) and ptid='{$data[ptid]}' and tid='{$data[tid]}' and  listurl='{$data[listurl]}' and gindex='{$data[gindex]}'";
    $t->rk("user_auto_url","userid,ip,pthost,ptid,tid,listurl,gindex,ptusername",$where,array("insert"=>1),$data);
    exit;
}

if(trim($_POST['sB1'])==""&&trim($_GET['plzq'])!=""){
    $ku=$t->sqlku("select * from user_auto_url where {$_POST[stype]}='{$_POST[s2key]}'");
    while($rs=mysql_fetch_array($ku)){
        $url="reset_send.php?onlyread=1&gather_type=6&s_url=".urlencode($rs[listurl])."&gindex=1&host={$rs[pthost]}&ptusername={$rs[ptusername]}&ptpassword={$rs[ptpassword]}&ptid={$rs[ptid]}&tid={$rs[tid]}&code=&cookie=&s=".rand(0,9999999);
        echo $url."\r\n";
        //file_get_contents($url);
    }
    exit;
}

if(trim($_GET['addupasss'])){
    $data=array();
    $data['userid']=trim($_POST['uuserid']);
    $data['ip']=trim($_POST['uip']);
    $data['host']=trim($_POST['upthost']);
    $data['ptid']=trim($_POST['uptid']);
    $data['ptusername']=trim($_POST['uptusername']);
    $data['ptpassword']=trim($_POST['uptpassword']);
    $where="(ip='{$data[ip]}' or userid='{$data[userid]}' and userid<>'' and userid<>0) and ptid='{$data[ptid]}' and host='{$data[host]}' and  ptusername='{$data[ptusername]}'";
    $t->rk("user_ptpass","userid,ip,host,ptid,ptusername,ptpassword",$where,array("insert"=>1),$data);
    exit;
}

?>